package com.autosalon.ui.automobil;

import java.util.ArrayList;
import java.util.List;

import com.autosalon.DAO.DaoFactory;
import com.autosalon.model.Doplnek;
import com.autosalon.model.Kategorie;
import com.autosalon.model.Model;
import com.autosalon.model.Vyrobce;
import com.autosalon.tools.Constants;
import com.autosalon.tools.IPaging;
import com.autosalon.tools.PagingComponent;
import com.autosalon.ui.ContentSwitcher;
import com.autosalon.ui.automobil.action.BackButton;
import com.autosalon.ui.automobil.action.ComboBoxChangeEvent;
import com.autosalon.ui.automobil.action.DeleteAutomobilAction;
import com.autosalon.ui.automobil.action.DeleteKategorielAction;
import com.autosalon.ui.automobil.action.DeleteModellAction;
import com.autosalon.ui.automobil.action.DeleteVyrobceAction;
import com.autosalon.ui.automobil.action.EditAutomobilAction;
import com.autosalon.ui.automobil.action.NewAutomobilAction;
import com.autosalon.ui.automobil.action.NewKategorieAction;
import com.autosalon.ui.automobil.action.NewModelAction;
import com.autosalon.ui.automobil.action.NewVyrobceAction;
import com.autosalon.ui.automobil.action.SaveAutomobilAction;
import com.autosalon.ui.automobil.action.SaveKategoriiAction;
import com.autosalon.ui.automobil.action.SaveModelAction;
import com.autosalon.ui.automobil.action.SaveVyrobceAction;
import com.autosalon.ui.automobil.action.UpdateAutomobilAction;
import com.autosalon.ui.automobil.state.AutomobilStateHolder;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.PopupDateField;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.TwinColSelect;
import com.vaadin.ui.VerticalLayout;

/**
 * Nastaveni komponent pro auomobily
 * @author Petr Kriegisch
 */
public class Automobil extends HorizontalLayout implements IPaging {

    private final ContentSwitcher switcher;
    private Form newCarForm;
    private Form newVyrobceForm;
    private Form newModelForm;
    private Form newKategorieForm;
    private HorizontalLayout vlButtonsPridavani;
    private HorizontalLayout hlTables;
    private VerticalLayout verticalLayoutTableAuta;
    private VerticalLayout vlTableButtons;
    private TextField lblCena;
    private TextField lblNajeto;
    private TextField lblNazevVyrobce;
    private TextField lblNazevModelu;
    private TextField lblNazevKategorie;
    private Table tabulkaAut;
    private Table tabulkaModelu;
    private Table tabulkaKategorii;
    private Table tabulkaVyrobcu;
    private Button btnPridavaniAut;
    private Button btnPridavaniVyrobce;
    private Button btnPridavaniModelu;
    private Button btnPridavaniKategorie;
    private Button btnVlozAutomobil;
    private Button btnVlozVyrobce;
    private Button btnVlozModel;
    private Button btnVlozKategorii;
    private Button btnZpet;
    private Button btnUpdate;
    private Button btnAddVyrobce;
    private Button btnAddVyrobce2;
    private Button btnAddKategorie;
    private Button btnAddModel;
    private com.autosalon.model.Automobil auto;
    private com.autosalon.model.Model model;
    private com.autosalon.model.Kategorie kategorie;
    private com.autosalon.model.Vyrobce vyrobce;
    private ComboBox cbVyrobce;
    private ComboBox cbModel;
    private ComboBox cbVyberVyrobceProModel;
    private ComboBox cbVyberKategoriiProModel;
    private PopupDateField pdDatum;
    private TwinColSelect tsVybava;
    private List<Object> automobils;
    private List<Object> models;
    private List<Object> kategories;
    private List<Object> vyrobci;
    private Doplnek doplnek;
    private PagingComponent pagingComponent;
    int id;

    public Automobil(ContentSwitcher switcher) {
        this.switcher = switcher;
        init();
    }

    /**
     * Inicializace komponent
     */
    private void init() {
        try {
            id = getSwitcher().getMainWindow().getZakaznik().getRole().getId().intValue();
        } catch (NullPointerException e) {
            id = 1;
        }
        pagingComponent = new PagingComponent(this);
        btnPridavaniAut = new Button("Pridat novy automobil");
        btnPridavaniVyrobce = new Button("Pridat noveho vyrobce");
        btnPridavaniModelu = new Button("Pridat novy model");
        btnPridavaniKategorie = new Button("Pridat novou kategorii");
        btnUpdate = new Button("Update");
        btnUpdate.addListener(new UpdateAutomobilAction(this));

        btnAddVyrobce = new Button("Novy vyrobce");
        btnAddVyrobce.addListener(new NewVyrobceAction(this));
        btnAddVyrobce.setStyleName(Button.STYLE_LINK);

        btnAddVyrobce2 = new Button("Novy vyrobce");
        btnAddVyrobce2.addListener(new NewVyrobceAction(this));
        btnAddVyrobce2.setStyleName(Button.STYLE_LINK);

        btnAddKategorie = new Button("Nova kategorie");
        btnAddKategorie.addListener(new NewKategorieAction(this));
        btnAddKategorie.setStyleName(Button.STYLE_LINK);

        btnAddModel = new Button("Novy model");
        btnAddModel.addListener(new NewModelAction(this));
        btnAddModel.setStyleName(Button.STYLE_LINK);

        vlButtonsPridavani = new HorizontalLayout();
        vlTableButtons = new VerticalLayout();
        vlTableButtons.setSpacing(true);

        hlTables = new HorizontalLayout();
        hlTables.setSpacing(true);

        verticalLayoutTableAuta = new VerticalLayout();
        verticalLayoutTableAuta.setSpacing(true);

        btnPridavaniAut.addListener(new NewAutomobilAction(this));
        btnPridavaniVyrobce.addListener(new NewVyrobceAction(this));
        btnPridavaniModelu.addListener(new NewModelAction(this));
        btnPridavaniKategorie.addListener(new NewKategorieAction(this));

        tabulkaAut = new Table();
        tabulkaAut.setCaption("Automobily");

        tabulkaModelu = new Table();
        tabulkaModelu.setCaption("Modely");

        tabulkaKategorii = new Table();
        tabulkaKategorii.setCaption("Kategorie");

        tabulkaVyrobcu = new Table();
        tabulkaVyrobcu.setCaption("Vyrobci");

        IndexedContainer icAut = new IndexedContainer();
        IndexedContainer icModelu = new IndexedContainer();
        IndexedContainer icVyrobce = new IndexedContainer();
        IndexedContainer icKategorie = new IndexedContainer();





        icAut.addContainerProperty("ZNACKA", String.class, null);
        icAut.addContainerProperty("MODEL", String.class, null);
        icAut.addContainerProperty("KAROSERIE", String.class, null);
        icAut.addContainerProperty("CENA", Integer.class, null);
        icAut.addContainerProperty("ROK VYROBY", String.class, null);
        icAut.addContainerProperty("NAJETO KM", Integer.class, null);
        if (id == 3) {
            icAut.addContainerProperty("Upravit", Button.class, null);
            icAut.addContainerProperty("Smazat", Button.class, null);
        }

        tabulkaAut.setContainerDataSource(icAut);

        icModelu.addContainerProperty("Nazev modelu", String.class, null);
        icModelu.addContainerProperty("Delete", Button.class, null);

        icKategorie.addContainerProperty("Typ karoserie", String.class, null);
        icKategorie.addContainerProperty("Delete", Button.class, null);

        icVyrobce.addContainerProperty("Nazev vyrobce", String.class, null);
        icVyrobce.addContainerProperty("Delete", Button.class, null);

        tabulkaAut.setSizeFull();
        tabulkaAut.setColumnWidth("NAZEV MODELU", 100);
        tabulkaAut.setColumnWidth("CENA", 100);
        tabulkaAut.setColumnWidth("ROK VYROBY", 100);
        tabulkaAut.setColumnWidth("NAJETO KM", 100);
        tabulkaAut.setColumnWidth("Action", 100);
        tabulkaAut.setWidth("100%");
        tabulkaAut.setHeight("100%");

        tabulkaModelu.setContainerDataSource(icModelu);
        tabulkaKategorii.setContainerDataSource(icKategorie);
        tabulkaVyrobcu.setContainerDataSource(icVyrobce);


        initFormNewCar();

        initFormNewVyrobce();

        initFormNewModel();

        initFormNewKategorie();

        naplneniVsechTabulek();


        vlButtonsPridavani.setSpacing(true);
        vlButtonsPridavani.addComponent(btnPridavaniAut);
        vlButtonsPridavani.addComponent(btnPridavaniVyrobce);
        vlButtonsPridavani.addComponent(btnPridavaniModelu);
        vlButtonsPridavani.addComponent(btnPridavaniKategorie);
        vlTableButtons.addComponent(pagingComponent);


        verticalLayoutTableAuta.addComponent(tabulkaAut);
        verticalLayoutTableAuta.addComponent(vlButtonsPridavani);


        hlTables.addComponent(verticalLayoutTableAuta);
        hlTables.addComponent(tabulkaKategorii);
        hlTables.addComponent(tabulkaVyrobcu);
        hlTables.addComponent(tabulkaModelu);

        vlTableButtons.addComponent(hlTables);
        addComponent(vlTableButtons);



        try {

            id = getSwitcher().getMainWindow().getZakaznik().getRole().getId().intValue();
        } catch (NullPointerException e) {
            id = 1;
        }

        AutomobilStateHolder.setState(AutomobilStateHolder.VIEW_AUTOMOBIL_STATE, id,
                this);
    }

    /**
     * Naplneni tabulky automobilu
     */
    @Override
    public void naplnTabulkuObjednavky() {

        automobils = new ArrayList<Object>();
        automobils = DaoFactory.getinstance().getAutomobil().getAll(pagingComponent.getFrom(), pagingComponent.getTo());
        tabulkaAut.removeAllItems();

        for (Object ob : automobils) {
            auto = (com.autosalon.model.Automobil) ob;

            if (id == 3) {
                Button btnShowAutomobil;
                btnShowAutomobil = new Button("Upravit");
                btnShowAutomobil.setStyleName(Button.STYLE_LINK);
                btnShowAutomobil.addListener(new EditAutomobilAction(this));
                btnShowAutomobil.setData(auto.getId());

                Button btnDeleteAutomobil;
                btnDeleteAutomobil = new Button("Smazat");
                btnDeleteAutomobil.setStyleName(Button.STYLE_LINK);
                btnDeleteAutomobil.addListener(new DeleteAutomobilAction(this));
                btnDeleteAutomobil.setData(auto.getId());
                tabulkaAut.addItem(new Object[]{auto.getModel().getVyrobce().getNazev_vyrobce(), auto.getModel().getNazev_modelu(), auto.getModel().getKategorie().getTyp_karoserie(), auto.getCena(), auto.getDatumVyroby().toString().substring(0, 4), auto.getNajeto(), btnShowAutomobil, btnDeleteAutomobil}, auto.getId());
            } else {
                tabulkaAut.addItem(new Object[]{auto.getModel().getVyrobce().getNazev_vyrobce(), auto.getModel().getNazev_modelu(), auto.getModel().getKategorie().getTyp_karoserie(), auto.getCena(), auto.getDatumVyroby().toString().substring(0, 4), auto.getNajeto()}, auto.getId());
            }
        }
    }

    /**
     * Naplneni tabulky modelu (nepouziva se)
     */
    public void naplneniTabulkyModelu() {

        models = new ArrayList<Object>();
        models = DaoFactory.getinstance().getModel().getAll(0, Integer.MAX_VALUE);
        tabulkaModelu.removeAllItems();

        for (Object ob : models) {
            model = (com.autosalon.model.Model) ob;

            Button btnDeleteModel;
            btnDeleteModel = new Button("Delete");
            btnDeleteModel.setStyleName(Button.STYLE_LINK);
            btnDeleteModel.addListener(new DeleteModellAction(this));
            btnDeleteModel.setData(model.getId());
            tabulkaModelu.addItem(new Object[]{model.getNazev_modelu(), btnDeleteModel}, null);
        }
    }

    /**
     * Naplneni tabulky kategorii (nepouziva se)
     */
    public void naplneniTabulkyKategorii() {

        kategories = new ArrayList<Object>();
        kategories = DaoFactory.getinstance().getKategorie().getAll(0, Integer.MAX_VALUE);
        tabulkaKategorii.removeAllItems();

        for (Object ob : kategories) {
            kategorie = (com.autosalon.model.Kategorie) ob;

            Button btnDeleteKAtegorii;
            btnDeleteKAtegorii = new Button("Delete");
            btnDeleteKAtegorii.setStyleName(Button.STYLE_LINK);
            btnDeleteKAtegorii.addListener(new DeleteKategorielAction(this));
            btnDeleteKAtegorii.setData(kategorie.getId());
            tabulkaKategorii.addItem(new Object[]{kategorie.getTyp_karoserie(), btnDeleteKAtegorii}, null);
//                tabulkaModelu.addItem(new Object[]{auto.getModel().getVyrobce().getNazev_vyrobce(), auto.getModel().getNazev_modelu(), auto.getCena(), auto.getDatumVyroby().toString().substring(0, 4), auto.getNajeto()}, null);
        }
    }

    /**
     * Naplneni tabulky vyrobcu (nepouziva se)
     */
    public void naplneniTabulkyVyrobcu() {

        vyrobci = new ArrayList<Object>();
        vyrobci = DaoFactory.getinstance().getVyrobce().getAll(0, Integer.MAX_VALUE);
        tabulkaVyrobcu.removeAllItems();

        for (Object ob : vyrobci) {
            vyrobce = (com.autosalon.model.Vyrobce) ob;

            Button btnDeleteVyrobce;
            btnDeleteVyrobce = new Button("Delete");
            btnDeleteVyrobce.setStyleName(Button.STYLE_LINK);
            btnDeleteVyrobce.addListener(new DeleteVyrobceAction(this));
            btnDeleteVyrobce.setData(vyrobce.getId());
            tabulkaVyrobcu.addItem(new Object[]{vyrobce.getNazev_vyrobce(), btnDeleteVyrobce}, null);
//                tabulkaModelu.addItem(new Object[]{auto.getModel().getVyrobce().getNazev_vyrobce(), auto.getModel().getNazev_modelu(), auto.getCena(), auto.getDatumVyroby().toString().substring(0, 4), auto.getNajeto()}, null);
        }
    }

    /**
     * Naplneni comboboxu s modelama
     */
    public void naplnModely(Object ob) {
        cbModel.removeAllItems();
        Vyrobce vyrobce2 = (Vyrobce) DaoFactory.getinstance().getVyrobce().getOneByParam(Constants.DB_VYROBCE_NAZEV_VYROBCE, ob);
        for (Model model2 : vyrobce2.getModely()) {
            cbModel.addItem((model2).getNazev_modelu());
        }


    }

    /**
     * Naplneni comboboxu s vyrobci
     */
    private void naplnVyrobce() {

        for (Object vyrobce3 : DaoFactory.getinstance().getVyrobce().getAll(0, Integer.MAX_VALUE)) {
            cbVyrobce.addItem(((Vyrobce) vyrobce3).getNazev_vyrobce());

        }
    }

    /**
     * Inicializace formulare pro novy automobil
     */
    public void initFormNewCar() {
        btnZpet = new Button("Zpet");
        btnZpet.addListener(new BackButton(this));
        if (newCarForm != null) {
            removeComponent(newCarForm);
        }
        lblCena = new TextField("Cena");
        lblNajeto = new TextField("Pocet najetych Km");

        cbModel = new ComboBox("Model");

        cbVyrobce = new ComboBox("Vyrobce");
        naplnVyrobce();


        cbVyrobce.addListener(new ComboBoxChangeEvent(this));

        pdDatum = new PopupDateField("Datum vyroby");
        pdDatum.setResolution(PopupDateField.RESOLUTION_DAY);

        tsVybava = new TwinColSelect("Vybava");
        tsVybava.setLeftColumnCaption("Mozna vybava");
        tsVybava.setRightColumnCaption("Vybrana vybava");


        for (Object object : DaoFactory.getinstance().getDoplnek().getAll(0, Integer.MAX_VALUE)) {
            doplnek = (Doplnek) object;
            tsVybava.addItem(doplnek.getPopis_doplnku());
        }


        btnVlozAutomobil = new Button("Vloz");
        btnVlozAutomobil.addListener(new SaveAutomobilAction(this));

        newCarForm = new Form();

        newCarForm.setCaption("Novy automobil");

        newCarForm.setDescription("\n" + "Formular slouzi pro vkladani novych automobilu.");

        newCarForm.getLayout().addComponent(cbVyrobce);
        newCarForm.getLayout().addComponent(cbModel);
        newCarForm.getLayout().addComponent(lblCena);
        newCarForm.getLayout().addComponent(lblNajeto);
        // newCarForm.getLayout().addComponent(lblRok);
        newCarForm.getLayout().addComponent(pdDatum);
        //newCarForm.getLayout().addComponent(lblDoplnky);
        newCarForm.getLayout().addComponent(tsVybava);

        newCarForm.getLayout().addComponent(btnAddVyrobce);
        newCarForm.getLayout().addComponent(btnAddModel);

        newCarForm.getFooter().addComponent(btnVlozAutomobil);
        newCarForm.getFooter().addComponent(btnUpdate);
        newCarForm.getFooter().addComponent(btnZpet);

        addComponent(newCarForm);
    }

    /**
     * Inicializace formulare pro noveho vyrobce
     */
    public void initFormNewVyrobce() {
        btnZpet = new Button("Zpet");
        btnZpet.addListener(new BackButton(this));
        lblNazevVyrobce = new TextField("Nazev vyrobce");
        btnVlozVyrobce = new Button("Vloz vyrobce");
        btnVlozVyrobce.addListener(new SaveVyrobceAction(this));
        newVyrobceForm = new Form();

        newVyrobceForm.setCaption("Novy vyrobce");
        newVyrobceForm.setDescription("\n" + "Formular slouzi pro vkladani novych vyrobcu.");

        newVyrobceForm.getLayout().addComponent(lblNazevVyrobce);
        newVyrobceForm.getFooter().addComponent(btnVlozVyrobce);
        newVyrobceForm.getFooter().addComponent(btnZpet);

        addComponent(newVyrobceForm);

    }

    /**
     * Inicializace formulare pro novou kategorii
     */
    public void initFormNewKategorie() {
        btnZpet = new Button("Zpet");
        btnZpet.addListener(new BackButton(this));
        lblNazevKategorie = new TextField("Typ karoserie");
        btnVlozKategorii = new Button("Vloz kategorii");
        btnVlozKategorii.addListener(new SaveKategoriiAction(this));
        newKategorieForm = new Form();
        newKategorieForm.setVisible(false);
        newKategorieForm.setCaption("Nova kategorie");
        newKategorieForm.setDescription("\n" + "Formular slouzi pro vkladani novych kategorii.");

        newKategorieForm.getLayout().addComponent(lblNazevKategorie);
        newKategorieForm.getFooter().addComponent(btnVlozKategorii);
        newKategorieForm.getFooter().addComponent(btnZpet);

        addComponent(newKategorieForm);

    }

    /**
     * Inicializace formulare pro novy model
     */
    public void initFormNewModel() {

        if (newModelForm != null) {
            removeComponent(newModelForm);
        }
        btnZpet = new Button("Zpet");
        cbVyberKategoriiProModel = new ComboBox("Kategorie");
        cbVyberVyrobceProModel = new ComboBox("Vyrobce");
        btnZpet.addListener(new BackButton(this));
        naplnComboboxyProModel();

        lblNazevModelu = new TextField("Nazev modelu");
        btnVlozModel = new Button("Vloz model");
        btnVlozModel.addListener(new SaveModelAction(this));

        newModelForm = new Form();
        newModelForm.setCaption("Novy model");
        newModelForm.setDescription("\n" + "Formular slouzi pro vkladani novych modelu.");


        newModelForm.getLayout().addComponent(lblNazevModelu);
        newModelForm.getLayout().addComponent(cbVyberKategoriiProModel);
        newModelForm.getLayout().addComponent(cbVyberVyrobceProModel);

        newModelForm.getLayout().addComponent(btnAddKategorie);
        newModelForm.getLayout().addComponent(btnAddVyrobce2);


        newModelForm.getFooter().addComponent(btnVlozModel);
        newModelForm.getFooter().addComponent(btnZpet);

        addComponent(newModelForm);

    }

    /**
     * Naplneni vsech tabulek hodnotami
     */
    public void naplneniVsechTabulek() {
        naplnTabulkuObjednavky();
        naplneniTabulkyModelu();
        naplneniTabulkyKategorii();
    }

    public void naplnComboboxyProModel() {
        cbVyberKategoriiProModel.removeAllItems();
        for (Object object : DaoFactory.getinstance().getKategorie().getAll(0, Integer.MAX_VALUE)) {
            cbVyberKategoriiProModel.addItem(((Kategorie) (object)).getTyp_karoserie());
        }
        cbVyberVyrobceProModel.removeAllItems();
        for (Object object : DaoFactory.getinstance().getVyrobce().getAll(0, Integer.MAX_VALUE)) {
            cbVyberVyrobceProModel.addItem(((Vyrobce) (object)).getNazev_vyrobce());
        }
    }

    public ContentSwitcher getSwitcher() {
        return switcher;
    }

    public Form getNewCarForm() {
        return newCarForm;
    }

    public void setNewCarForm(Form newCarForm) {
        this.newCarForm = newCarForm;
    }

    public Button getBtnPridavani() {
        return btnPridavaniAut;
    }

    public void setBtnPridavani(Button btnPridavani) {
        this.btnPridavaniAut = btnPridavani;
    }

    public Table getTabulkaAut() {
        return tabulkaAut;
    }

    public void setTabulka(Table tabulka) {
        this.tabulkaAut = tabulka;
    }

    public Button getBtnPridavaniModelu() {
        return btnPridavaniModelu;
    }

    public void setBtnPridavaniModelu(Button btnPridavaniModelu) {
        this.btnPridavaniModelu = btnPridavaniModelu;
    }

    public Button getBtnPridavaniVyrobce() {
        return btnPridavaniVyrobce;
    }

    public void setBtnPridavaniVyrobce(Button btnPridavaniVyrobce) {
        this.btnPridavaniVyrobce = btnPridavaniVyrobce;
    }

    public ComboBox getCbModel() {
        return cbModel;
    }

    public void setCbModel(ComboBox cbModel) {
        this.cbModel = cbModel;
    }

    public TextField getLblCena() {
        return lblCena;
    }

    public void setLblCena(TextField lblCena) {
        this.lblCena = lblCena;
    }

    public PopupDateField getPdDatum() {
        return pdDatum;
    }

    public void setPdDatum(PopupDateField pdDatum) {
        this.pdDatum = pdDatum;
    }

    public TextField getLblKm() {
        return lblNajeto;
    }

    public void setLblKm(TextField lblKm) {
        this.lblNajeto = lblKm;
    }

    public ComboBox getCbVyrobce() {
        return cbVyrobce;
    }

    public void setCbVyrobce(ComboBox cbVyrobce) {
        this.cbVyrobce = cbVyrobce;
    }

    public TwinColSelect getTsVybava() {
        return tsVybava;
    }

    public void setTsVybava(TwinColSelect tsVybava) {
        this.tsVybava = tsVybava;
    }

    public TextField getLblNazevVyrobce() {
        return lblNazevVyrobce;
    }

    public void setLblNazevVyrobce(TextField lblNazevVyrobce) {
        this.lblNazevVyrobce = lblNazevVyrobce;
    }

    public Form getNewVyrobceForm() {
        return newVyrobceForm;
    }

    public void setNewVyrobceForm(Form newVyrobceForm) {
        this.newVyrobceForm = newVyrobceForm;
    }

    public ComboBox getCbVyberKategoriiProModel() {
        return cbVyberKategoriiProModel;
    }

    public void setCbVyberKategoriiProModel(ComboBox cbVyberKategoriiProModel) {
        this.cbVyberKategoriiProModel = cbVyberKategoriiProModel;
    }

    public ComboBox getCbVyberVyrobceProModel() {
        return cbVyberVyrobceProModel;
    }

    public void setCbVyberVyrobceProModel(ComboBox cbVyberVyrobceProModel) {
        this.cbVyberVyrobceProModel = cbVyberVyrobceProModel;
    }

    public TextField getLblNazevModelu() {
        return lblNazevModelu;
    }

    public void setLblNazevModelu(TextField lblNazevModelu) {
        this.lblNazevModelu = lblNazevModelu;
    }

    public Form getNewModelForm() {
        return newModelForm;
    }

    public void setNewModelForm(Form newModelForm) {
        this.newModelForm = newModelForm;
    }

    public Button getBtnUpdate() {
        return btnUpdate;
    }

    public void setBtnUpdate(Button btnUpdate) {
        this.btnUpdate = btnUpdate;
    }

    public Button getBtnVlozAutomobil() {
        return btnVlozAutomobil;
    }

    public void setBtnVlozAutomobil(Button btnVlozAutomobil) {
        this.btnVlozAutomobil = btnVlozAutomobil;
    }

    public Button getBtnVlozModel() {
        return btnVlozModel;
    }

    public void setBtnVlozModel(Button btnVlozModel) {
        this.btnVlozModel = btnVlozModel;
    }

    public Button getBtnVlozVyrobce() {
        return btnVlozVyrobce;
    }

    public void setBtnVlozVyrobce(Button btnVlozVyrobce) {
        this.btnVlozVyrobce = btnVlozVyrobce;
    }

    public Button getBtnPridavaniKategorie() {
        return btnPridavaniKategorie;
    }

    public void setBtnPridavaniKategorie(Button btnPridavaniKategorie) {
        this.btnPridavaniKategorie = btnPridavaniKategorie;
    }

    public Form getNewKategorieForm() {
        return newKategorieForm;
    }

    public void setNewKategorieForm(Form newKategorieForm) {
        this.newKategorieForm = newKategorieForm;
    }

    public TextField getLblNazevKategorie() {
        return lblNazevKategorie;
    }

    public void setLblNazevKategorie(TextField lblNazevKategorie) {
        this.lblNazevKategorie = lblNazevKategorie;
    }

    public PagingComponent getPagingComponent() {
        return pagingComponent;
    }

    public void setPagingComponent(PagingComponent pagingComponent) {
        this.pagingComponent = pagingComponent;
    }

    public Table getTabulkaModelu() {
        return tabulkaModelu;
    }

    public void setTabulkaModelu(Table tabulkaModelu) {
        this.tabulkaModelu = tabulkaModelu;
    }

    public HorizontalLayout getHlTables() {
        return hlTables;
    }

    public void setHlTables(HorizontalLayout hlTables) {
        this.hlTables = hlTables;
    }

    public Table getTabulkaKategorii() {
        return tabulkaKategorii;
    }

    public void setTabulkaKategorii(Table tabulkaKategorii) {
        this.tabulkaKategorii = tabulkaKategorii;
    }

    public Table getTabulkaVyrobcu() {
        return tabulkaVyrobcu;
    }

    public void setTabulkaVyrobcu(Table tabulkaVyrobcu) {
        this.tabulkaVyrobcu = tabulkaVyrobcu;
    }
}
